// pages/login/login.js
var zm = require('../../utils/zm_tools.js')
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    inputShowed: false,
    tabs: ["1111", "33333", "22222"],
    inputVal: "",
    //标签类型
    lxval: "",
    lxlist: [],
    lxindex: 0,
    //时间选项
    sjval: "",
    sjlist: [{ bm: "01", mc: "三天前" },{ bm: "02", mc: "一周前" },{ bm: "03", mc: "两周前" }],
    sjindex: 0,
    //赏金选项
    shangjinval: "",
    shangjinlist: [{ bm: "01", mc: "10元以下" }, { bm: "02", mc: "10--100元" }, { bm: "03", mc: "100--500元" }, { bm: "04", mc: "500元以上" }],
    shangjinindex: 0,

    rwlist: []
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //查询列表
    var that = this;
    if (app.globalData.renwuleixing.length>0) {
      that.setData({
        lxlist: app.globalData.renwuleixing
      })
    } else {
      //加载类型
      zm.post("/getziyuan/leixing", {}, function (r) {
        that.setData({
          lxlist: r.jg
        })
      });
    }
    this.chaxunlist();
  },
  chaxunlist:function(){
    var that = this;
    let param={
      lx:this.data.lxval,
      sj: this.data.sjval,
      shangjin: this.data.shangjinval
    };
zm.get("/renwu/getall",param,function(r){
  that.setData({
    rwlist: r.rwlist
  })
});
  },
  bianqiangaibian:function(e){
    this.setData({
      lxindex: e.detail.value,
      lxval: this.data.lxlist[e.detail.value].bm
    })
    this.chaxunlist();
  },
  shijiangaibian: function (e) {
    this.setData({
      sjindex: e.detail.value,
      sjval: this.data.sjlist[e.detail.value].bm
    })
    this.chaxunlist();
  },
  shangjingaibian: function (e) {
    this.setData({
      shangjinindex: e.detail.value,
      shangjinval: this.data.shangjinlist[e.detail.value].bm
    })
    this.chaxunlist();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})